package jdbmaplite.mapper;

import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;

import jdbmaplite.manager.ParseConfigException;
import jdbmaplite.util.MethodInfo;

public interface SqlDefinitionFactory {

	/**
	 * Format Sql
	 * 
	 * @param sqlDef
	 *            SqlDefinition
	 * @param parameterNames
	 *            String[]
	 * @param parameterValues
	 *            Object...
	 * @return String
	 * @throws FormatSqlException
	 */
	public String formatSql(SqlDefinition sqlDef, String[] parameterNames,
			Object... parameterValues) throws FormatSqlException;

	/**
	 * Format Sql By Object
	 * 
	 * @param sqlDef
	 *            SqlDefinition
	 * @param object
	 *            Object
	 * @return String
	 * @throws FormatSqlException
	 */
	public String formatSqlByObject(SqlDefinition sqlDef, Object object)
			throws FormatSqlException;

	/**
	 * Convert Result Value
	 * 
	 * @param rs
	 *            ResultSet
	 * @param columnIndex
	 *            int
	 * @param mappingType
	 *            Class
	 * @return Object
	 * @throws SQLException
	 */
	public Object convertResultValue(ResultSet rs, int columnIndex,
			Class<?> mappingType) throws SQLException;

	/**
	 * Reload Sql Definition
	 * 
	 * @throws ParseConfigException
	 */
	public void reloadSqlDefinition() throws ParseConfigException;

	/**
	 * Get SqlDefinition
	 * 
	 * @param elementId
	 *            String
	 * @return SqlDefinition
	 */
	public SqlDefinition getSqlDefinition(String elementId);

	/**
	 * Get MethodInfo
	 * 
	 * @param executedBy
	 *            Class
	 * @param shiftTraceCount
	 *            int
	 * @param parameters
	 *            Object...
	 * @return MethodInfo
	 * @throws IOException
	 */
	public MethodInfo getMethodInfo(Class<?> executedBy, int shiftTraceCount,
			Object... parameters) throws IOException;

}